﻿using jinmaMesProxy.Model;
using jinmaMesProxy.Service;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;

namespace jinmaMesProxy.Controllers
{
    [ApiController]
    [Route("api/[controller]/[action]")]
    public class RdRecord09Controller : MyController
    {
        RdRecord09Service rd09Service = new RdRecord09Service();
        [HttpPost, Authorize]
        public ResponseData<RdRecord09> SaveOnly(RdRecord09 data)
        {
            rd09Service.Save(data,false);
            return new ResponseData<RdRecord09>([data]);
        }
        [HttpPost, Authorize]
        public ResponseData<RdRecord09> SaveAndApprove(RdRecord09 data)
        {
            rd09Service.Save(data, true);
            return new ResponseData<RdRecord09>([data]);
        }

        [HttpGet, HttpPost, Authorize]
        public ResponseData<RdRecord09> GetByCode(string code)
        {
            return new ResponseData<RdRecord09>([rd09Service.GetByCode(code)]);
        }
    }
}
